package spike.jdbc.access;

import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.DriverManager;
import java.sql.ResultSet;

public class MainAllColumns {

	public static void main(String[] args) throws Exception {
		System.out.println("loading driver");
		Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

		System.out.println("connecting");
		Connection vConnection = DriverManager.getConnection(
				"jdbc:odbc:VEHICULES", "rothlis18", "Duke-123");

		DatabaseMetaData vMetaData = vConnection.getMetaData();
		ResultSet vColumns = vMetaData.getColumns(null, null, null, null);
		System.out.println("columns found :");
		while (vColumns.next()) {
			//String vSchemaName = vColumns.getString("TABLE_CAT");
			String vTableName = vColumns.getString("TABLE_NAME");
			String vColumnName = vColumns.getString("COLUMN_NAME");
			System.out.println("\t"  + ":" + vTableName + "." + vColumnName);
		}
		System.out.println();
		vColumns.close();

		vConnection.close();

		System.out.println("done");
	}

}
